from django.db import models

from lapi_app.models.bug_model.bug import Project
from lapi_app.models.testcase_model.testcase import Testcase
from lapi_app.models.ui_model.ui_case import UI_case
from lapi_app.models.user_model.user_info import Userinfo


class Menu(models.Model):
    id = models.AutoField(primary_key=True)
    label = models.CharField(max_length=38, verbose_name='菜单名称')
    pid = models.IntegerField(default=0, verbose_name='父id')
    type = models.IntegerField(default=1, verbose_name='类型', null=False)
    # 1是文件夹，2是接口，3是UI文件夹，4是UI用例，5是需求文件夹，6是需求目录
    testcase = models.ForeignKey(Testcase, on_delete=models.CASCADE, null=True)
    ui = models.ForeignKey(UI_case, on_delete=models.CASCADE, null=True)
    m_user = models.ForeignKey(Userinfo, on_delete=models.CASCADE)

    def __str__(self):
        return self.label
